home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
drcpas10.zip
/
ABSTOOLS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-11-17
|
1KB
|
45 lines
{$A+,B-,D-,F-,I+,L-,N-,O-,R-,S+,V-}
Unit AbsTools;
(* by David R. Conrad, for Turbo Pascal 5.5
This code is not copyrighted, you may use it freely.
There are no guarantees, either expressed or implied,
as to either merchantability or fitness for a particular
purpose. The author's liability is limited to the amount
you paid for it.
David R. Conrad, 17 Nov 92
David_Conrad@mts.cc.wayne.edu
dave@michigan.com
*)
Interface
(* determine whether a disk is write-protected by first reading, then
writing the boot sector. returns False if the read fails.
some monitoring programs may complain about the write of the boot
sector, so you may want to use another sector, but most monitoring
programs would also complain about the int 25h/26h access to the
disk anyway.
*)
function WriteProtected (drive : byte) : boolean;
Implementation
Uses AbsIO;
var
sector : array[1..512] of byte;
function WriteProtected (drive : byte) : boolean;
begin
AbsRead (drive, 0, 1, sector);
If AbsError <> 0 then begin WriteProtected := False; exit; end;
AbsWrite (drive, 0, 1, sector);
WriteProtected := AbsError <> 0;
end;
End.